// 管理员相关类型
export interface Admin {
  id: string;
  username: string;
  email: string;
  roleId: string;
  role: Role;
  status: 'active' | 'inactive';
  createdAt: string;
  updatedAt: string;
}

export interface Role {
  id: string;
  name: string;
  permissions: Permission[];
  description?: string;
}

export interface Permission {
  id: string;
  name: string;
  code: string;
  module: string;
  description?: string;
}

// 用户管理类型
export interface User {
  id: string;
  username: string;
  email: string;
  phone: string;
  avatar?: string;
  status: 'active' | 'inactive';
  createdAt: string;
  updatedAt: string;
}

// 商品管理类型
export interface Product {
  id: string;
  name: string;
  description: string;
  price: number;
  originalPrice?: number;
  images: string[];
  categoryId: string;
  category?: Category;
  stock: number;
  sales: number;
  status: 'active' | 'inactive';
  createdAt: string;
  updatedAt: string;
}

// 分类管理类型
export interface Category {
  id: string;
  name: string;
  icon?: string;
  parentId?: string;
  parent?: Category;
  sort: number;
  status: 'active' | 'inactive';
  children?: Category[];
  productCount?: number;
}

// 订单管理类型
export interface Order {
  id: string;
  orderNo: string;
  userId: string;
  user?: User;
  status: 'pending' | 'paid' | 'shipped' | 'delivered' | 'cancelled';
  totalAmount: number;
  shippingAddress: Address;
  items: OrderItem[];
  paymentMethod?: string;
  paymentTime?: string;
  shippingTime?: string;
  deliveryTime?: string;
  createdAt: string;
  updatedAt: string;
}

export interface OrderItem {
  id: string;
  productId: string;
  product: Product;
  quantity: number;
  price: number;
}

export interface Address {
  id: string;
  userId: string;
  name: string;
  phone: string;
  province: string;
  city: string;
  district: string;
  detail: string;
  isDefault: boolean;
}

// 统计数据类型
export interface DashboardStats {
  totalUsers: number;
  totalOrders: number;
  totalProducts: number;
  totalRevenue: number;
  todayOrders: number;
  todayRevenue: number;
  userGrowth: number;
  orderGrowth: number;
}

export interface ChartData {
  date: string;
  value: number;
  type?: string;
}

// API响应类型
export interface ApiResponse<T = any> {
  code: number;
  message: string;
  data: T;
}

// 分页类型
export interface Pagination {
  current: number;
  pageSize: number;
  total: number;
}

export interface PaginatedResponse<T> {
  list: T[];
  pagination: Pagination;
}

// 表单类型
export interface ProductForm {
  name: string;
  description: string;
  price: number;
  originalPrice?: number;
  categoryId: string;
  stock: number;
  images: string[];
  status: 'active' | 'inactive';
}

export interface CategoryForm {
  name: string;
  icon?: string;
  parentId?: string;
  sort: number;
  status: 'active' | 'inactive';
}

export interface AdminForm {
  username: string;
  email: string;
  password?: string;
  roleId: string;
  status: 'active' | 'inactive';
}

export interface RoleForm {
  name: string;
  description?: string;
  permissions: string[];
} 